package com.yc.blog.biz.impl;

import java.util.List;

import com.yc.blog.bean.BlogInfo;
import com.yc.blog.biz.IBlogInfoBiz;
import com.yc.blog.dao.IBlogInfoDao;
import com.yc.blog.dao.impl.BlogInfoDaoImpl;
import com.yc.blog.util.StringUtil;

public class BlogInfoBizImpl implements IBlogInfoBiz{

	@Override
	public int add(String tid, String title, String content, int aid) {
		if(StringUtil.chekNUll(tid,title,content)) {
			return -1;
		}
		
		IBlogInfoDao blogInfoDao = new BlogInfoDaoImpl();
		return blogInfoDao.add(tid, title, content, aid);
	}

	@Override
	public List<BlogInfo> findByPage(int page, int rows) {
		IBlogInfoDao blogInfoDao = new BlogInfoDaoImpl();
		return blogInfoDao.findByPage(page, rows);
	}

	@Override
	public BlogInfo findByBid(String bid) {
		if(StringUtil.chekNUll(bid)) {
			return null;
		}
		
		IBlogInfoDao blogInfoDao = new BlogInfoDaoImpl();
		return blogInfoDao.findByBid(bid);
	}
	
}
